package com.glink.manage.mqtt;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.UUID;

@Component
@Data
public class MqttProperties {
    @Value("${mqtt.broker:tcp://192.168.1.31:11883}")
    private String broder;

    @Value("${mqtt.userName:}")
    private String userName;
    @Value("${mqtt.password:}")
    private String password;
    @Value("${mqtt.timeout:10}")
    private int timeout;
    @Value("${mqtt.maxInflight:10}")
    private int maxInflight;
    @Value("${mqtt.qos:2}")
    private int qos;
    @Value("${mqtt.clientIdPrefix:}")
    private String clientIdPrefix;
    @Value("${mqtt.timeToWait:5000}")
    private int timeToWait;
    @Value("${mqtt.keepalive:60}")
    private int keepalive;
    @Value("${mqtt.barrier_gate.host:192.168.1.31}")
    private String host;
    @Value("${mqtt.barrier_gate.port:11883}")
    private int port;
    @Value("${mqtt.barrier_gate.userName:}")
    private String barrierGateUserName;
    @Value("${mqtt.barrier_gate.password:}")
    private String barrierGatePassword;

    public String getClientId() {
        return this.clientIdPrefix + UUID.randomUUID();
    }
}
 